Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[User] 친구 신청 조회 API 구현 #174

Merged
merged 13 commits into from
Jun 18, 2024

Conversation

minahYu
Copy link
Contributor

@minahYu minahYu commented Jun 14, 2024

#️⃣연관된 이슈

📝작업 내용

  • 친구신청 조회 API 구현하였습니다.
  • 친구신청 조회 관련 Controller 테스트코드를 작성하였습니다.
  • 친구신청 조회 관련 Service 테스트코드를 작성하였습니다.

@minahYu minahYu added enhancement 추가 기능 API 상세 api 문서 Test 테스트 코드 User 유저 관련기능 labels Jun 14, 2024
@minahYu minahYu added this to the MSA 채팅 서비스 개발 milestone Jun 14, 2024
@minahYu minahYu requested a review from a team June 14, 2024 09:31
@minahYu minahYu self-assigned this Jun 14, 2024
Copy link
Contributor

@yudonggeun yudonggeun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨어요!

Comment on lines 22 to 27
val friendRequests: MutableList<GetFriendRequestResponse> = mutableListOf()

for (friendRelation in friendRelations) {
val friend = friendRelation.friend
friendRequests.add(GetFriendRequestResponse(friend.id!!, friend.username))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stream api 사용하면 좀 더 가독성 좋은 코드가 될 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 stream api 사용해 코드 수정해보겠습니다~!

Comment on lines +258 to +261
"data.friendRequests" type JsonDataType.Arrays mean "친구신청한 사용자 리스트"
"data.friendRequests[].friendId" type Strings mean "친구신청한 사용자 아이디"
"data.friendRequests[].username" type Strings mean "친구신청한 사용자 닉네임"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

frinedRequest는 무슨의미로 사용한 건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

friendReuqests는 로그인한 사용자가 받은 친구신청 목록을 의미합니다!

Copy link
Member

@minisundev minisundev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생많으셨어요1!!👍😉

@PostMapping("/user/{userId}/friend/{friendId}")
fun addFriend(
@RequestHeader("Authorization") token: String,
@PathVariable userId: Long,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 토큰에서 뽑을 수 있는 userId랑은 다른 정보일까요?! 제가 생각하기에는 요청하는 user의 id를 토큰에서 뽑아와서 사용하면 될 것 같은데..! 입력을 따로 받는 이유가 있나요?! 궁금합니다 😽

Copy link
Contributor Author

@minahYu minahYu Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

토큰에서 뽑을 수 있는 userId랑 같은 정보입니다! 기존에 작성되어 있던 코드들이 pathVariable로 userId를 받아와서 동일하게 코드 작성했었는데, user쪽 기능 구현 다 하면 수정해봐도 좋을 것 같아요! 추후에 수정하겠습니다~!


data class GetFriendRequestsResponse(
val userId: Long,
var friendRequests: MutableList<GetFriendRequestResponse>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

immutable한 타입을 사용하는것은 어떻게 생각하시낭요??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가져온 친구 신청 목록 담는 용도라 immutable한 타입이 좋겠네요!! 해당 코드 수정하겠습니다~!

@minahYu minahYu merged commit 45630c4 into kSideProject:dev Jun 18, 2024
1 check passed
@minahYu minahYu deleted the feat/get-friend-requests branch June 18, 2024 06:36
@minahYu minahYu restored the feat/get-friend-requests branch June 18, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API 상세 api 문서 enhancement 추가 기능 Test 테스트 코드 User 유저 관련기능
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants